VFG.Tip=function(viewer, options) {
	this.viewer = viewer;
	this.options = options;
	this.frameDiv=this.viewer.cesiumWidget.container;
	this.isInit=false;
	this.init();
}
VFG.Tip.prototype.init = function() {
	var _self = this;
    if (_self.isInit) { return; }
    
    var div = document.createElement('DIV');
    div.className = "vfg-draw-tooltip right";

    var arrow = document.createElement('DIV');
    arrow.className = "vfg-draw-tooltip-arrow";
    div.appendChild(arrow);

    var title = document.createElement('DIV');
    title.className = "vfg-draw-tooltip-inner";
    div.appendChild(title);
    
    this._div = div;
    this._title = title;
    _self.frameDiv.appendChild(div);
    _self.isInit = true;
};
VFG.Tip.prototype.setVisible = function(visible) {
	var _self = this;
    if (!_self.isInit) { return; }
    _self._div.style.display = visible ? 'block' : 'none';
};
VFG.Tip.prototype.showAt = function (position, message) {
	var _self = this;
    if (!_self.isInit) { return; }
    if (position && message) {
    	_self.setVisible(true);
    	_self._title.innerHTML = message;
    	_self._div.style.position = "absolute"
    	_self._div.style.left = position.x + 20 + "px";
    	_self._div.style.top = (position.y - this._div.clientHeight/2) + "px";
    }
};
VFG.Tip.prototype.destroy = function() {
	var _self = this;
	if( _self._div){
		$( _self._div).remove();
	}
	if( _self._title){
		$( _self._title).remove();
	}
	return Cesium.destroyObject(this);
};